<?php

namespace App\Models;



class SiteInfo extends Base
{

    // 用户管理
    protected $table = 'site_info';

    // 缓存字段，用于搜索绑定的字段
    protected $cacheFields = ['id'];


    // 获取图片
    public function getContentAttribute($value)
    {
        return $this->replaceDomain($value, 'full');
    }

    // 保存图片
    public function setContentAttribute($value)
    {
        return $this->replaceDomain($value, 'old');
    }


    // 定义验证操作
    public function rules()
    {

        $add = [
        ];

        $edit = [
        ];

        $info = [
        ];


        $rule = [
            //'title'   => 'required',
            'content' => 'required',
            //'status'  => ['in:0,1,2'],
        ];


        $msg = [
            //'status'  => '状态 1-正常 0-禁用',
            'id'      => '编号',
            'title'   => '名称',
            'content' => '内容',
            'itype'   => '类型  html text',
            'ctime'   => '创建时间',
            'mtime'   => '修改时间',
        ];

        return ['rule' => $rule, 'msg' => $msg, 'add' => $add];
    }
}
